<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>管理员控制面板 - 城市智慧系统</title>
  <link rel="stylesheet" href="styles.css">
  <style>
    body {
      background: #f5f8fa;
      display: block;
      min-height: 100vh;
      margin: 0;
      padding: 0;
      font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
      color: #333;
    }

    body::before {
      display: none;
    }

    .container {
      max-width: 1600px;
      margin: 20px auto;
      padding: 0 20px;
    }

    .admin-panel {
      max-width: 1400px;
      margin: 0 auto;
    }

    .admin-header {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      margin-bottom: 30px;
      background: #fff;
      padding: 25px 20px;
      border-radius: 10px;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
      text-align: center;
    }

    .admin-title {
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 15px;
    }

    .admin-icon {
      margin-right: 10px;
      color: #3498db;
    }

    .admin-header h2 {
      margin: 0;
      color: #2c3e50;
      font-size: 24px;
    }

    .admin-subtitle {
      color: #7f8c8d;
      margin-bottom: 15px;
      font-size: 14px;
    }

    .logout-btn {
      background-color: #e74c3c;
      color: white;
      border: none;
      padding: 8px 20px;
      border-radius: 4px;
      cursor: pointer;
      transition: background-color 0.3s;
      margin-top: 5px;
      font-weight: 500;
    }

    .logout-btn:hover {
      background-color: #c0392b;
    }

    .admin-content {
      background: #fff;
      border-radius: 10px;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
      overflow: hidden;
    }

    .admin-tabs {
      display: flex;
      background: #3498db;
      color: white;
      flex-wrap: wrap;
    }

    .admin-tab {
      padding: 15px 25px;
      cursor: pointer;
      font-weight: 500;
      transition: background-color 0.3s;
    }

    .admin-tab:hover {
      background-color: #2980b9;
    }

    .admin-tab.active {
      background-color: #2980b9;
      font-weight: bold;
    }

    .admin-tab-content {
      display: none;
      padding: 20px;
    }

    .admin-tab-content.active {
      display: block;
    }

    .admin-tab-content h3 {
      margin-top: 0;
      color: #2c3e50;
      margin-bottom: 20px;
    }

    .admin-tab-content table {
      text-align: center;
    }

    .search-container {
      display: flex;
      margin-bottom: 20px;
      gap: 10px;
      max-width: 100%;
    }

    .search-input {
      flex: 9;
      padding: 10px 15px;
      border: 1px solid #ddd;
      border-radius: 4px;
      font-size: 14px;
      box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
      transition: all 0.3s ease;
    }

    .search-input:focus {
      border-color: #3498db;
      outline: none;
      box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 0 0 2px rgba(52, 152, 219, 0.2);
      transform: translateY(-1px);
    }

    .search-input::placeholder {
      color: #95a5a6;
    }

    .search-btn {
      flex: 1;
      min-width: 80px;
      max-width: 120px;
      padding: 10px 15px;
      background-color: #3498db;
      color: white;
      border: none;
      border-radius: 4px;
      cursor: pointer;
      text-align: center;
      font-weight: 500;
      transition: all 0.3s ease;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .search-btn:hover {
      background-color: #2980b9;
      transform: translateY(-2px);
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }

    .search-btn:active {
      transform: translateY(0);
      box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
    }

    .table-actions {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 15px;
    }

    .refresh-btn {
      padding: 8px 15px;
      background-color: #95a5a6;
      color: white;
      border: none;
      border-radius: 4px;
      cursor: pointer;
      display: flex;
      align-items: center;
    }

    .refresh-btn:hover {
      background-color: #7f8c8d;
    }

    .refresh-btn svg {
      margin-right: 5px;
    }

    .empty-state {
      text-align: center;
      padding: 50px 20px;
      color: #7f8c8d;
    }

    .empty-state svg {
      width: 64px;
      height: 64px;
      margin-bottom: 20px;
      color: #bdc3c7;
    }

    .empty-state h4 {
      margin: 0 0 10px 0;
      color: #2c3e50;
    }

    .empty-state p {
      margin: 0;
    }

    .user-detail-modal {
      display: none;
      position: fixed;
      z-index: 100;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      background-color: rgba(0, 0, 0, 0.5);
      overflow-y: auto;
    }

    .modal-content {
      background-color: #fff;
      margin: 5% auto;
      padding: 30px;
      border-radius: 10px;
      max-width: 600px;
      width: 90%;
      position: relative;
      box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
      animation: modalFadeIn 0.3s ease;
    }

    @media (max-height: 700px) {
      .modal-content {
        margin: 3% auto;
      }
    }

    @media (min-height: 900px) {
      .modal-content {
        margin: 8% auto;
      }
    }

    @keyframes modalFadeIn {
      from {
        opacity: 0;
        transform: translateY(20px);
      }

      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    .close-modal {
      position: absolute;
      right: 20px;
      top: 15px;
      font-size: 24px;
      cursor: pointer;
      color: #7f8c8d;
      transition: color 0.3s;
      z-index: 10;
    }

    .close-modal:hover {
      color: #34495e;
    }

    .user-detail-list {
      list-style: none;
      padding: 0;
      margin: 0 0 20px 0;
      max-height: 400px;
      overflow-y: auto;
      border: 1px solid #eee;
      border-radius: 5px;
      padding: 10px;
    }

    .user-detail-list li {
      margin-bottom: 12px;
      padding-bottom: 12px;
      border-bottom: 1px solid #ecf0f1;
      display: flex;
    }

    .user-detail-list li:last-child {
      margin-bottom: 0;
      padding-bottom: 0;
      border-bottom: none;
    }

    .user-detail-list .detail-label {
      font-weight: bold;
      width: 150px;
      color: #7f8c8d;
      flex-shrink: 0;
    }

    .user-detail-value {
      flex: 1;
      word-break: break-word;
    }

    .user-status-filter {
      margin-bottom: 20px;
      display: flex;
      flex-wrap: wrap;
    }

    .filter-btn {
      padding: 8px 20px;
      margin-right: 10px;
      margin-bottom: 10px;
      border: none;
      background-color: #ecf0f1;
      border-radius: 20px;
      cursor: pointer;
      transition: all 0.3s;
      font-weight: 500;
    }

    .filter-btn:hover {
      background-color: #bdc3c7;
    }

    .filter-btn.active {
      background-color: #3498db;
      color: white;
      box-shadow: 0 2px 5px rgba(52, 152, 219, 0.3);
    }

    .comment-input {
      width: 100%;
      padding: 12px;
      margin-bottom: 15px;
      border: 1px solid #ddd;
      border-radius: 5px;
      resize: vertical;
      min-height: 80px;
      transition: border-color 0.3s;
      box-sizing: border-box;
    }

    .comment-input:focus {
      border-color: #3498db;
      outline: none;
    }

    .user-list {
      width: 100%;
      border-collapse: collapse;
      margin-bottom: 20px;
    }

    .user-list th {
      background-color: #f8f9fa;
      padding: 12px 15px;
      text-align: left;
      border-bottom: 2px solid #ecf0f1;
      color: #7f8c8d;
      font-weight: 600;
    }

    .user-list td {
      padding: 12px 15px;
      border-bottom: 1px solid #ecf0f1;
    }

    .user-list tbody tr:hover {
      background-color: #f8f9fa;
    }

    .action-btn {
      border: none;
      border-radius: 4px;
      padding: 5px 10px;
      cursor: pointer;
      margin-right: 5px;
      font-size: 14px;
      transition: all 0.3s;
    }

    .details-btn,
    .delete-btn,
    .course-delete-btn {
      min-width: 48px !important;
      max-width: 90px !important;
      width: auto !important;
      padding: 6px 16px !important;
      font-size: 14px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      white-space: nowrap;
    }

    .details-btn:hover {
      background-color: #2980b9;
    }

    .approve-btn {
      background-color: #2ecc71;
      color: white;
    }

    .approve-btn:hover {
      background-color: #27ae60;
    }

    .reject-btn {
      background-color: #e74c3c;
      color: white;
      justify-items: right;
    }

    .reject-btn:hover {
      background-color: #c0392b;
    }

    #approvalActions {
      background-color: #f8f9fa;
      padding: 20px;
      border-radius: 5px;
      margin-top: 20px;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    }

    #approvalActions h4 {
      margin-top: 0;
      margin-bottom: 15px;
      color: #2c3e50;
    }

    /* 优化审核按钮样式 */
    #approvalActions .action-btn {
      padding: 12px 25px;
      margin-right: 15px;
      cursor: pointer;
      font-size: 16px;
      font-weight: bold;
      min-width: 120px;
      border-radius: 6px;
      text-align: center;
    }

    #approvalActions .approve-btn {
      background-color: #2ecc71;
      color: white;
      border: none;
      border-radius: 4px;
      box-shadow: 0 2px 5px rgba(46, 204, 113, 0.3);
      transition: all 0.3s;
    }

    #approvalActions .approve-btn:hover {
      background-color: #27ae60;
      transform: translateY(-2px);
      box-shadow: 0 4px 8px rgba(46, 204, 113, 0.4);
    }

    #approvalActions .approve-btn:active {
      transform: translateY(0);
      box-shadow: 0 2px 3px rgba(46, 204, 113, 0.4);
    }

    #approvalActions .reject-btn {
      background-color: #e74c3c;
      color: white;
      border: none;
      border-radius: 4px;
      box-shadow: 0 2px 5px rgba(231, 76, 60, 0.3);
      transition: all 0.3s;
    }

    #approvalActions .reject-btn:hover {
      background-color: #c0392b;
      transform: translateY(-2px);
      box-shadow: 0 4px 8px rgba(231, 76, 60, 0.4);
    }

    #approvalActions .reject-btn:active {
      transform: translateY(0);
      box-shadow: 0 2px 3px rgba(231, 76, 60, 0.4);
    }

    .action-btn-container {
      display: flex;
      margin-top: 20px;
      justify-content: center;
      align-items: center;
    }

    footer {
      text-align: center;
      margin-top: 30px;
      padding: 15px;
      color: #7f8c8d;
      font-size: 13px;
    }

    .module-title {
      width: 100%;
      padding: 10px 15px;
      background-color: #2c3e50;
      color: white;
      font-weight: bold;
      display: flex;
      align-items: center;
    }

    .module-title svg {
      margin-right: 10px;
    }

    /* 身份模块的子导航 */
    .identity-tabs {
      display: flex;
      background-color: #f8f9fa;
      border-radius: 4px;
      overflow: hidden;
      margin-bottom: 20px;
    }

    .identity-tab {
      padding: 12px 20px;
      cursor: pointer;
      font-weight: 500;
      transition: all 0.3s;
      color: #7f8c8d;
    }

    .identity-tab:hover {
      background-color: #ecf0f1;
      color: #2c3e50;
    }

    .identity-tab.active {
      background-color: #ecf0f1;
      color: #2c3e50;
      font-weight: bold;
      box-shadow: inset 0 -3px 0 #3498db;
    }

    .identity-tab-content {
      display: none;
    }

    .identity-tab-content.active {
      display: block;
    }

    /* 学生模块样式 */
    .student-app-item {
      background: white;
      border-radius: 6px;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
      padding: 15px;
      margin-bottom: 15px;
      display: flex;
      flex-wrap: wrap;
    }

    .student-app-header {
      width: 100%;
      display: flex;
      justify-content: space-between;
      margin-bottom: 10px;
      padding-bottom: 10px;
      border-bottom: 1px solid #ecf0f1;
    }

    .student-app-title {
      font-weight: bold;
      color: #2c3e50;
    }

    .student-app-date {
      color: #95a5a6;
      font-size: 14px;
    }

    .student-app-content {
      width: 70%;
      padding-right: 20px;
    }

    .student-app-actions {
      width: 30%;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
    }

    /* 教师模块样式 */
    .career-plan-card {
      background: white;
      border-radius: 6px;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
      padding: 15px;
      margin-bottom: 15px;
    }

    .career-plan-header {
      display: flex;
      justify-content: space-between;
      margin-bottom: 10px;
      padding-bottom: 10px;
      border-bottom: 1px solid #ecf0f1;
    }

    /* 课程安排样式 */
    .course-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
      gap: 15px;
      margin-top: 20px;
    }

    .course-card {
      background: white;
      border-radius: 6px;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
      padding: 15px;
      transition: all 0.3s;
    }

    .course-card:hover {
      transform: translateY(-3px);
      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }

    .modal-title {
      font-size: 22px;
      color: #2c3e50;
      margin-bottom: 20px;
      padding-bottom: 15px;
      border-bottom: 1px solid #eee;
      text-align: center;
    }

    #approvalComment {
      height: 100px;
      font-size: 15px;
    }

    #courseModuleContent table th,
    #courseModuleContent table td {
      font-size: 13px;
      padding: 10px 8px;
      white-space: nowrap;
      max-width: 120px;
      overflow: hidden;
      text-overflow: ellipsis;
      height: 38px;
    }

    #courseModuleContent table {
      table-layout: fixed;
      width: 100%;
    }

    #courseModuleContent .action-btn {
      min-width: 48px;
      max-width: 70px;
      padding: 6px 10px;
      font-size: 13px;
      margin-left: 6px;
      margin-right: 0;
      display: inline-block;
      white-space: nowrap;
      box-sizing: border-box;
    }

    #courseModuleContent td:last-child {
      white-space: nowrap;
    }

    #courseModuleContent .course-btn-group {
      float: right;
      margin-top: 0;
    }

    #courseModuleContent .course-section-row {
      font-size: 13px;
      background: #f8f9fa;
      border-top: none;
      position: relative;
      height: 38px;
    }

    #courseModuleContent .course-section-row span {
      color: #555;
      font-size: 13px;
      line-height: 38px;
    }

    #courseModuleContent .course-btn-group {
      position: absolute;
      right: 16px;
      top: 6px;
    }

    .course-delete-btn {
      background-color: #e74c3c;
      color: white;
      border: none;
      border-radius: 4px;
      padding: 5px 10px;
      cursor: pointer;
      margin-right: 5px;
      font-size: 14px;
      transition: all 0.3s;
      width: 4px;
    }

    .course-delete-btn:hover {
      background-color: #c0392b;
    }

    /* 新增课程模态框美化 */
    #addCourseModal .modal-content {
      background: #fff;
      border-radius: 12px;
      box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
      padding: 36px 32px 28px 32px;
      max-width: 420px;
      width: 95%;
      margin: 60px auto;
      position: relative;
    }

    #addCourseModal .modal-title {
      text-align: center;
      font-size: 24px;
      font-weight: bold;
      color: #2c3e50;
      margin-bottom: 28px;
      letter-spacing: 2px;
    }

    #addCourseModal label {
      font-weight: 600;
      margin-bottom: 6px;
      margin-top: 8px;
      color: #34495e;
      letter-spacing: 1px;
    }

    #addCourseModal input,
    #addCourseModal select {
      width: 100%;
      padding: 10px 12px;
      border: 1.5px solid #d0d7de;
      border-radius: 6px;
      font-size: 15px;
      margin-top: 4px;
      margin-bottom: 14px;
      transition: border-color 0.2s, box-shadow 0.2s;
      background: #f8fafc;
    }

    #addCourseModal input:focus,
    #addCourseModal select:focus {
      border-color: #409eff;
      outline: none;
      box-shadow: 0 0 0 2px #e3f0fc;
      background: #fff;
    }

    #addCourseModal .action-btn {
      min-width: 90px;
      height: 40px;
      font-size: 16px;
      border-radius: 6px;
      margin-left: 0;
      margin-right: 0;
      margin-top: 0;
      font-weight: 500;
      box-shadow: none;
      transition: background 0.2s, color 0.2s;
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      padding: 0;
    }

    #addCourseModal .add-course-confirm-btn {
      background: #409eff;
      color: #fff;
      border: none;
      margin-left: 12px;
      display: flex;
      text-align: center;
      display: flex;
    }

    #addCourseModal .add-course-confirm-btn:hover {
      background: #1976d2;
    }

    #addCourseModal .add-course-cancel-btn {
      background: #fff0f0;
      color: #e74c3c;
      border: 1.5px solid #e74c3c;
      display: flex;
      text-align: center;
    }

    #addCourseModal .add-course-cancel-btn:hover {
      background: #e74c3c;
      color: #fff;
    }

    #addCourseModal .close-modal {
      position: absolute;
      right: 22px;
      top: 18px;
      font-size: 28px;
      color: #aaa;
      cursor: pointer;
      transition: color 0.2s;
    }

    #addCourseModal .close-modal:hover {
      color: #e74c3c;
    }

    #addCourseModal form>div[style*='justify-content: flex-end'] {
      display: flex !important;
      flex-direction: row !important;
      justify-content: space-between !important;
      align-items: center;
      gap: 0 !important;
      margin-top: 24px !important;
    }

    #addCourseModal .add-course-cancel-btn {
      margin-left: 0 !important;
      margin-right: auto !important;
    }

    #addCourseModal .add-course-confirm-btn {
      margin-right: 0 !important;
      margin-left: auto !important;
    }

    /* 操作按钮顺序调整：删除按钮在最右侧 */
    #pendingUserTable td:last-child,
    #approvedUserTable td:last-child,
    #rejectedUserTable td:last-child,
    #courseTable td:last-child {
      display: flex;
      flex-direction: row;
      justify-content: flex-start;
      align-items: center;
      gap: 0;
    }

    .details-btn {
      order: 1;
      margin-right: 10px;
    }

    .delete-btn,
    .course-delete-btn {
      order: 2;
      margin-right: 0;
    }
  </style>
</head>

<body>
  <div class="container">
    <div class="admin-panel">
      <div class="admin-header">
        <div class="admin-title">
          <span class="admin-icon">
            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
              stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
              <path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
              <circle cx="12" cy="7" r="4"></circle>
            </svg>
          </span>
          <h2>管理员控制面板</h2>
        </div>
        <div class="admin-subtitle">用户账号审核与管理系统</div>
        <div class="avatar"
          style="width: 50px; height: 50px; border-radius: 50%; background-color: #ddd; display: flex; align-items: center; justify-content: center; overflow: hidden; margin-bottom: 15px;">
          <img src="" alt="用户头像" style="width: 100%; height: 100%; object-fit: cover;">
        </div>
        <button id="logoutBtn" class="logout-btn">退出登录</button>
      </div>
      <div class="admin-content">
        <div class="admin-tabs">
          <!-- 互动模块 -->
          <div class="module-title">
            <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none"
              stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
              <path
                d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z">
              </path>
            </svg>
            互动模块
          </div>
          <div class="admin-tab" data-tab="student">学生模块</div>
          <div class="admin-tab" data-tab="teacher">教师模块</div>
          <div class="admin-tab active" data-tab="identity">身份模块</div>

          <!-- 发配模块 -->
          <div class="module-title" id="mainModuleTitle">
            <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none"
              stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
              <rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect>
              <line x1="16" y1="2" x2="16" y2="6"></line>
              <line x1="8" y1="2" x2="8" y2="6"></line>
              <line x1="3" y1="10" x2="21" y2="10"></line>
            </svg>
            <span id="mainModuleTitleText">信息修改模块</span>
          </div>
          <div class="admin-tab" data-tab="info-edit">学生信息修改</div>
          <div class="admin-tab" data-tab="course-assign">课程安排</div>
        </div>

        <!-- 审核模块（身份模块内容） -->
        <div class="admin-tab-content active" id="identityTab">
          <h3>用户身份审核</h3>
          <div class="identity-tabs">
            <div class="identity-tab active" data-identity-tab="pending">待审核用户</div>
            <div class="identity-tab" data-identity-tab="approved">已审核用户</div>
            <div class="identity-tab" data-identity-tab="rejected">已拒绝用户</div>
          </div>

          <div class="identity-tab-content active" id="pendingTab">
            <div class="search-container">
              <input type="text" class="search-input" placeholder="输入姓名、邮箱或学号进行搜索..." id="pendingSearchInput">
              <button class="search-btn" id="pendingSearchBtn">
                <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"
                  stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
                  style="margin-right: 5px;">
                  <circle cx="11" cy="11" r="8"></circle>
                  <line x1="21" y1="21" x2="16.65" y2="16.65"></line>
                </svg>
                查询
              </button>
            </div>

            <div class="user-status-filter">
              <button class="filter-btn active" data-role="all">全部</button>
              <button class="filter-btn" data-role="student">学生</button>
              <button class="filter-btn" data-role="teacher">教师</button>
            </div>

            <div class="table-actions">
              <button class="refresh-btn" id="refreshPendingBtn">
                <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"
                  stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                  <path d="M23 4v6h-6"></path>
                  <path d="M1 20v-6h6"></path>
                  <path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10"></path>
                  <path d="M20.49 15a9 9 0 0 1-14.85 3.36L1 14"></path>
                </svg>
                刷新数据
              </button>
            </div>

            <table class="user-list" id="pendingUserTable">
              <thead>
                <tr>
                  <th>ID</th>
                  <th>用户名</th>
                  <th>电子邮箱</th>
                  <th>身份</th>
                  <th>注册时间</th>
                  <th>操作</th>
                </tr>
              </thead>
              <tbody>
                <!-- 这里将通过JavaScript动态填充数据 -->
              </tbody>
            </table>
          </div>

          <div class="identity-tab-content" id="approvedTab">
            <div class="search-container">
              <input type="text" class="search-input" placeholder="输入姓名、邮箱或学号进行搜索..." id="approvedSearchInput">
              <button class="search-btn" id="approvedSearchBtn">
                <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"
                  stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
                  style="margin-right: 5px;">
                  <circle cx="11" cy="11" r="8"></circle>
                  <line x1="21" y1="21" x2="16.65" y2="16.65"></line>
                </svg>
                查询
              </button>
            </div>
            <div class="user-status-filter">
              <button class="filter-btn active" data-role="all">全部</button>
              <button class="filter-btn" data-role="student">学生</button>
              <button class="filter-btn" data-role="teacher">教师</button>
            </div>
            <div class="table-actions">
              <button class="refresh-btn" id="refreshApprovedBtn">
                <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"
                  stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                  <path d="M23 4v6h-6"></path>
                  <path d="M1 20v-6h6"></path>
                  <path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10"></path>
                  <path d="M20.49 15a9 9 0 0 1-14.85 3.36L1 14"></path>
                </svg>
                刷新数据
              </button>
            </div>
            <table class="user-list" id="approvedUserTable">
              <thead>
                <tr>
                  <th>ID</th>
                  <th>用户名</th>
                  <th>电子邮箱</th>
                  <th>身份</th>
                  <th>批准时间</th>
                  <th>操作</th>
                </tr>
              </thead>
              <tbody>
                <!-- 这里将通过JavaScript动态填充数据 -->
              </tbody>
            </table>
          </div>

          <div class="identity-tab-content" id="rejectedTab">
            <div class="search-container">
              <input type="text" class="search-input" placeholder="输入姓名、邮箱或学号进行搜索..." id="rejectedSearchInput">
              <button class="search-btn" id="rejectedSearchBtn">
                <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"
                  stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
                  style="margin-right: 5px;">
                  <circle cx="11" cy="11" r="8"></circle>
                  <line x1="21" y1="21" x2="16.65" y2="16.65"></line>
                </svg>
                查询
              </button>
            </div>
            <div class="user-status-filter">
              <button class="filter-btn active" data-role="all">全部</button>
              <button class="filter-btn" data-role="student">学生</button>
              <button class="filter-btn" data-role="teacher">教师</button>
            </div>
            <div class="table-actions">
              <button class="refresh-btn" id="refreshRejectedBtn">
                <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"
                  stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                  <path d="M23 4v6h-6"></path>
                  <path d="M1 20v-6h6"></path>
                  <path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10"></path>
                  <path d="M20.49 15a9 9 0 0 1-14.85 3.36L1 14"></path>
                </svg>
                刷新数据
              </button>
            </div>
            <table class="user-list" id="rejectedUserTable">
              <thead>
                <tr>
                  <th>ID</th>
                  <th>用户名</th>
                  <th>电子邮箱</th>
                  <th>身份</th>
                  <th>拒绝时间</th>
                  <th>拒绝原因</th>
                  <th>操作</th>
                </tr>
              </thead>
              <tbody>
                <!-- 这里将通过JavaScript动态填充数据 -->
              </tbody>
            </table>
          </div>
        </div>

        <!-- 信息修改模块（学生模块内容） -->
        <div class="admin-tab-content" id="info-editTab">
          <h3>学生信息修改申请</h3>

          <div class="search-container">
            <input type="text" class="search-input" placeholder="输入学号或姓名进行搜索..." id="infoEditSearchInput">
            <button class="search-btn" id="infoEditSearchBtn">
              <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"
                stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
                style="margin-right: 5px;">
                <circle cx="11" cy="11" r="8"></circle>
                <line x1="21" y1="21" x2="16.65" y2="16.65"></line>
              </svg>
              查询
            </button>
          </div>

          <div class="user-status-filter">
            <button class="filter-btn active" data-status="all">全部</button>
            <button class="filter-btn" data-status="pending">待审核</button>
            <button class="filter-btn" data-status="approved">已批准</button>
            <button class="filter-btn" data-status="rejected">已拒绝</button>
          </div>

          <div class="table-actions">
            <button class="refresh-btn" id="refreshInfoEditBtn">
              <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"
                stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                <path d="M23 4v6h-6"></path>
                <path d="M1 20v-6h6"></path>
                <path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10"></path>
                <path d="M20.49 15a9 9 0 0 1-14.85 3.36L1 14"></path>
              </svg>
              刷新数据
            </button>
          </div>

          <table class="user-list" id="infoEditTable">
            <thead>
              <tr>
                <th>学号</th>
                <th>姓名</th>
                <th>修改类型</th>
                <th>申请时间</th>
                <th>状态</th>
                <th>操作</th>
              </tr>
            </thead>
            <tbody>
              <!-- 这里将通过JavaScript动态填充数据 -->
            </tbody>
          </table>
        </div>

        <!-- 课程模块（教师模块内容） -->
        <div class="admin-tab-content" id="courseModuleContent">
          <h3>课程信息</h3>
          <div style="display: flex; justify-content: flex-end; align-items: center; margin-bottom: 16px;">
            <input type="text" id="courseNameInput" placeholder="请输入课程名称"
              style="height:32px; border-radius:4px; border:1px solid #ccc; padding:0 10px; margin-right:8px;">
            <button id="searchBtn"
              style="background:#e6f0fa; color:#3b5998; border:1px solid #bcdffb; border-radius:4px; height:32px; margin-right:8px;">查询</button>
            <button id="resetBtn"
              style="background:#fff7e6; color:#e6a23c; border:1px solid #ffe1b2; border-radius:4px; height:32px; margin-right:16px;">重置</button>
            <button id="addBtn"
              style="background:#f4faff; color:#409eff; border:1px solid #b3e5fc; border-radius:4px; height:32px; margin-right:8px;">新增</button>
            <button id="batchDeleteBtn"
              style="background:#fff0f0; color:#f56c6c; border:1px solid #fab6b6; border-radius:4px; height:32px;">批量删除</button>
          </div>
          <!-- 新增课程模态框 -->
          <div class="user-detail-modal" id="addCourseModal">
            <div class="modal-content" style="max-width: 500px;">
              <span class="close-modal" id="closeAddCourseModal">&times;</span>
              <h3 class="modal-title">新增课程</h3>
              <form id="addCourseForm">
                <div style="display: flex; flex-direction: column; gap: 12px;">
                  <label>课程名称 <input type="text" name="course_name" required style="width: 100%; padding: 6px;"></label>
                  <label>课程类型 <select name="course_type" id="courseTypeSelect" required
                      style="width: 100%; padding: 6px;">
                      <option value="必修">必修</option>
                      <option value="选修">选修</option>
                    </select></label>
                  <label>授课教师 <select name="teacher" id="teacherSelect" required
                      style="width: 100%; padding: 6px;"></select></label>
                  <label>学分 <input type="number" name="credit" required style="width: 100%; padding: 6px;"></label>
                  <label>上课人数 <input type="number" name="student_count" required
                      style="width: 100%; padding: 6px;"></label>
                  <label>上课教室 <input type="text" name="classroom" required style="width: 100%; padding: 6px;"></label>
                  <label>周几 <select name="weekday" id="weekdaySelect" required style="width: 100%; padding: 6px;">
                      <option value="周日">周日</option>
                      <option value="周一">周一</option>
                      <option value="周二">周二</option>
                      <option value="周三">周三</option>
                      <option value="周四">周四</option>
                      <option value="周五">周五</option>
                      <option value="周六">周六</option>
                    </select></label>
                  <label>第几大节 <select name="section" id="sectionSelect" required style="width: 100%; padding: 6px;">
                      <option value="第一大节">第一大节</option>
                      <option value="第二大节">第二大节</option>
                      <option value="第三大节">第三大节</option>
                      <option value="第四大节">第四大节</option>
                      <option value="第五大节">第五大节</option>
                    </select></label>
                </div>
                <div style="display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px;">
                  <button type="button" id="cancelAddCourseBtn" class="action-btn add-course-cancel-btn">取消</button>
                  <button type="submit" class="action-btn add-course-confirm-btn">确认</button>
                </div>
              </form>
            </div>
          </div>
          <table class="user-list" id="courseTable">
            <thead>
              <tr>
                <th><input type="checkbox" id="selectAllCourses"></th>
                <th>序号</th>
                <th>课程名称</th>
                <th>课程类型</th>
                <th>授课教师</th>
                <th>学分</th>
                <th>上课人数</th>
                <th>上课教室</th>
                <th>周几</th>
                <th>第几大节</th>
                <th>操作</th>
              </tr>
            </thead>
            <tbody>
              <!-- 这里将通过JavaScript动态填充数据 -->
            </tbody>
          </table>
        </div>
      </div>
    </div>
  </div>

  <!-- 用户详情模态框 -->
  <div class="user-detail-modal" id="userDetailModal">
    <div class="modal-content">
      <span class="close-modal">&times;</span>
      <h3 class="modal-title">用户详细信息</h3>
      <ul class="user-detail-list" id="userDetailList">
        <!-- 这里将通过JavaScript动态填充数据 -->
      </ul>

      <div id="approvalActions">
        <h4>审核操作</h4>
        <textarea class="comment-input" id="approvalComment" placeholder="请输入审核意见（批准可选，拒绝必填）"></textarea>
        <div class="action-btn-container">
          <button class="action-btn approve-btn" id="approveUserBtn">批准</button>
          <button class="action-btn reject-btn" id="rejectUserBtn">拒绝</button>
        </div>
      </div>
    </div>
  </div>

  <!-- 信息修改详情模态框 -->
  <div class="user-detail-modal" id="infoEditDetailModal">
    <div class="modal-content">
      <span class="close-modal" id="closeInfoEditModal">&times;</span>
      <h3 class="modal-title">信息修改申请详情</h3>

      <div class="info-edit-details">
        <div class="student-info-section">
          <h4>学生基本信息</h4>
          <ul class="user-detail-list" id="studentInfoList">
            <!-- 这里将通过JavaScript动态填充数据 -->
          </ul>
        </div>

        <div class="edit-info-section">
          <h4>修改内容</h4>
          <div class="info-comparison">
            <div class="old-info">
              <h5>原信息</h5>
              <ul class="user-detail-list" id="oldInfoList">
                <!-- 这里将通过JavaScript动态填充数据 -->
              </ul>
            </div>
            <div class="new-info">
              <h5>新信息</h5>
              <ul class="user-detail-list" id="newInfoList">
                <!-- 这里将通过JavaScript动态填充数据 -->
              </ul>
            </div>
          </div>
        </div>

        <div class="request-info-section">
          <h4>申请信息</h4>
          <ul class="user-detail-list" id="requestInfoList">
            <!-- 这里将通过JavaScript动态填充数据 -->
          </ul>
        </div>
      </div>

      <div id="infoEditApprovalActions">
        <h4>审核操作</h4>
        <textarea class="comment-input" id="infoEditComment" placeholder="请输入审核意见（批准可选，拒绝必填）"></textarea>
        <div class="action-btn-container">
          <button class="action-btn approve-btn" id="approveInfoEditBtn" data-request-id="">批准</button>
          <button class="action-btn reject-btn" id="rejectInfoEditBtn" data-request-id="">拒绝</button>
        </div>
      </div>
    </div>
  </div>

  <!-- 编辑课程模态框 -->
  <div class="user-detail-modal" id="editCourseModal">
    <div class="modal-content" style="max-width: 500px;">
      <span class="close-modal" id="closeEditCourseModal">&times;</span>
      <h3 class="modal-title">编辑课程</h3>
      <form id="editCourseForm">
        <input type="hidden" name="id" id="editCourseId">
        <div style="display: flex; flex-direction: column; gap: 12px;">
          <label>课程名称 <input type="text" name="course_name" id="editCourseName" required
              style="width: 100%; padding: 6px;"></label>
          <label>课程类型 <select name="course_type" id="editCourseType" required style="width: 100%; padding: 6px;">
              <option value="必修">必修</option>
              <option value="选修">选修</option>
            </select></label>
          <label>授课教师 <input type="text" name="teacher" id="editCourseTeacher" required
              style="width: 100%; padding: 6px;"></label>
          <label>学分 <input type="number" name="credit" id="editCourseCredit" required
              style="width: 100%; padding: 6px;"></label>
          <label>上课人数 <input type="number" name="student_count" id="editCourseStudentCount" required
              style="width: 100%; padding: 6px;"></label>
          <label>上课教室 <input type="text" name="classroom" id="editCourseClassroom" required
              style="width: 100%; padding: 6px;"></label>
          <label>周几 <select name="weekday" id="editCourseWeekday" required style="width: 100%; padding: 6px;">
              <option value="周日">周日</option>
              <option value="周一">周一</option>
              <option value="周二">周二</option>
              <option value="周三">周三</option>
              <option value="周四">周四</option>
              <option value="周五">周五</option>
              <option value="周六">周六</option>
            </select></label>
          <label>第几大节 <select name="section" id="editCourseSection" required style="width: 100%; padding: 6px;">
              <option value="第一大节">第一大节</option>
              <option value="第二大节">第二大节</option>
              <option value="第三大节">第三大节</option>
              <option value="第四大节">第四大节</option>
              <option value="第五大节">第五大节</option>
            </select></label>
        </div>
        <div style="display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px;">
          <button type="button" id="cancelEditCourseBtn" class="action-btn add-course-cancel-btn">取消</button>
          <button type="submit" class="action-btn add-course-confirm-btn">保存</button>
        </div>
      </form>
    </div>
  </div>

  <footer>
    &copy; 2023 城市智慧系统 - 管理员控制台 v1.0
  </footer>

  <script src="admin.js"></script>
  <script>
    // 初始化身份模块子标签页切换功能
    document.addEventListener('DOMContentLoaded', function () {
      // 页面加载时初始化模块显示状态
      initializeModuleVisibility();

      // 获取所有身份模块子标签和内容区域
      const identityTabs = document.querySelectorAll('.identity-tab');
      const identityTabContents = document.querySelectorAll('.identity-tab-content');

      // 为每个子标签添加点击事件
      identityTabs.forEach(tab => {
        tab.addEventListener('click', function () {
          // 移除所有活动状态
          identityTabs.forEach(t => t.classList.remove('active'));
          identityTabContents.forEach(c => c.classList.remove('active'));

          // 设置当前标签页为活动状态
          this.classList.add('active');
          const tabName = this.dataset.identityTab;
          const tabContentElement = document.getElementById(`${tabName}Tab`);

          if (tabContentElement) {
            tabContentElement.classList.add('active');
            console.log('切换到身份子标签:', tabName);

            // 确保加载对应页签的数据
            if (tabName === 'pending' || tabName === 'approved' || tabName === 'rejected') {
              // 触发刷新以重新加载数据
              const refreshBtn = document.getElementById(`refresh${tabName.charAt(0).toUpperCase() + tabName.slice(1)}Btn`);
              if (refreshBtn) {
                refreshBtn.click();
              } else {
                console.warn(`未找到刷新按钮: refresh${tabName.charAt(0).toUpperCase() + tabName.slice(1)}Btn`);
              }
            }

            if (tabName === 'student') {
              if (infoModuleTitle) infoModuleTitle.style.display = 'flex';
            } else {
              if (infoModuleTitle) infoModuleTitle.style.display = 'none';
            }
          } else {
            console.error(`未找到标签内容元素: ${tabName}Tab`);
          }
        });
      });
    });

    // 页面加载时初始化模块显示状态
    function initializeModuleVisibility() {
      const infoModuleTitle = document.querySelector('.module-title:nth-of-type(2)');
      const infoModuleTabs = document.querySelectorAll('.admin-tab[data-tab="info-edit"], .admin-tab[data-tab="course-assign"]');
      if (infoModuleTitle) infoModuleTitle.style.display = 'none';
      infoModuleTabs.forEach(tab => {
        if (tab) tab.style.display = 'none';
      });
    }

    function showOnlyModule(tabName) {
      const audit = document.getElementById('auditModule');
      const info = document.getElementById('infoModule');
      const course = document.getElementById('courseModule');
      [audit, info, course].forEach(el => { if (el) el.style.display = 'none'; });
      if (tabName === 'identity') {
        if (audit) audit.style.display = 'block';
      } else if (tabName === 'student') {
        if (info) info.style.display = 'block';
      } else if (tabName === 'teacher') {
        if (course) course.style.display = 'block';
      }
    }

    // 在tab切换事件中调用
    tabs.forEach(tab => {
      tab.addEventListener('click', function () {
        // ...原有tab切换逻辑...
        const tabName = this.dataset.tab;
        showOnlyModule(tabName);
      });
    });

    // 页面初始化时全部隐藏
    showOnlyModule('');

    // 新增课程模态框弹出逻辑
    document.addEventListener('DOMContentLoaded', function () {
      var addBtn = document.getElementById('addBtn');
      var addCourseModal = document.getElementById('addCourseModal');
      var closeAddCourseModal = document.getElementById('closeAddCourseModal');
      var cancelAddCourseBtn = document.getElementById('cancelAddCourseBtn');
      addBtn && addBtn.addEventListener('click', function () {
        addCourseModal.style.display = 'block';
      });
      closeAddCourseModal && closeAddCourseModal.addEventListener('click', function () {
        addCourseModal.style.display = 'none';
      });
      cancelAddCourseBtn && cancelAddCourseBtn.addEventListener('click', function () {
        addCourseModal.style.display = 'none';
      });
      // 点击模态框外部关闭
      window.addEventListener('click', function (event) {
        if (event.target === addCourseModal) {
          addCourseModal.style.display = 'none';
        }
      });
    });

    // 禁止页面滚动
    function disableBodyScroll() {
      document.body.style.overflow = 'hidden';
    }
    // 恢复页面滚动
    function enableBodyScroll() {
      document.body.style.overflow = '';
    }
    // 监听模态框弹出和关闭
    (function () {
      var addBtn = document.getElementById('addBtn');
      var addCourseModal = document.getElementById('addCourseModal');
      var closeAddCourseModal = document.getElementById('closeAddCourseModal');
      var cancelAddCourseBtn = document.getElementById('cancelAddCourseBtn');
      if (addBtn && addCourseModal) {
        addBtn.addEventListener('click', function () {
          addCourseModal.style.display = 'block';
          disableBodyScroll();
        });
      }
      if (closeAddCourseModal && addCourseModal) {
        closeAddCourseModal.addEventListener('click', function () {
          addCourseModal.style.display = 'none';
          enableBodyScroll();
        });
      }
      if (cancelAddCourseBtn && addCourseModal) {
        cancelAddCourseBtn.addEventListener('click', function () {
          addCourseModal.style.display = 'none';
          enableBodyScroll();
        });
      }
      window.addEventListener('click', function (event) {
        if (event.target === addCourseModal) {
          addCourseModal.style.display = 'none';
          enableBodyScroll();
        }
      });
    })();
  </script>
</body>

</html>